package com.mycompany.j2eem.controller;

import com.mycompany.j2eem.Aop.GetIp;
import com.mycompany.j2eem.Aop.JudgeLog;
import com.mycompany.j2eem.Entity.JsonResult;
import com.mycompany.j2eem.service.wucyservice.LoginService;
import javax.servlet.http.HttpSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author asus
 */

@GetIp
@RestController
public class Controller {

    @Autowired
    LoginService loginservice;

//    @JudgeLog
    
    @RequestMapping("/test1")
    public String test(HttpSession session) {
         String thisMethodName = new Exception().getStackTrace()[0].getMethodName();// 获得当前的方法名
        String thisClassName = new Exception().getStackTrace()[0].getClassName();// 获得当前的类名
        session.setAttribute("errorSource", "方法名称->" + thisMethodName + "   |  " + "控制器名称->" + thisClassName);
        return session.getAttribute("errorSource").toString();
    }

    @RequestMapping("/test2")
    public String test2(HttpSession session){
        String thisMethodName = new Exception().getStackTrace()[0].getMethodName();// 获得当前的方法名
        String thisClassName = new Exception().getStackTrace()[0].getClassName();// 获得当前的类名
        session.setAttribute("errorSource", "方法名称->" + thisMethodName + "   |  " + "控制器名称->" + thisClassName);
       return session.getAttribute("number").toString();
    }

    private void set_class_name(HttpSession session) {
        String thisMethodName = new Exception().getStackTrace()[0].getMethodName();// 获得当前的方法名
        String thisClassName = new Exception().getStackTrace()[0].getClassName();// 获得当前的类名
        session.setAttribute("errorSource", "方法名称->" + thisMethodName + "   |  " + "控制器名称->" + thisClassName);
    }

}
